<?php
$this->headTitle('Post edit');
$this->placeholder('content_title')->set('Write Your Post');
$this->placeholder('body_onload')->set('document.formPostEdit.post_title.focus();');

if (!empty($this->details)) {
    foreach ($this->details as $detail) {
        $this->{'detailId_' . $detail->detailLocaleId}      = $detail->detailId;
        $this->{'detailTitle_' . $detail->detailLocaleId}   = $detail->detailTitle;
        $this->{'detailContent_' . $detail->detailLocaleId} = $detail->detailContent;
    }
}
?>
<div>
    <form name="formPostEdit" id="formPostEdit" method="post" action="<?php echo $this->U('post', 'save'); ?>">
    
        <?php echo $this->formHidden('postId', $this->postId); ?>
        <?php echo $this->formHidden('postAuthorId', 1); ?>
        <?php echo $this->formHidden('postCreatedAt', $this->postCreatedAt); ?>
        <?php echo $this->formHidden('postUpdatedAt', ''); ?>

        <div>
            <label>Title in url (option): </label>
            <?php echo $this->formText('postUrlTitle', $this->postUrlTitle, array('maxlength' => 255, 'size' => '70')); ?>

        </div>

        <div class="cl" style="height:15px;">&nbsp;</div>

        <div class="fl">
            <label>Adjusted or not : </label>
            <?php echo $this->formSelect('postAdjusted', $this->postAdjusted, null, array(0 => 'false', 1 => 'true')); ?>
        </div>

        <div class="fl" width="50px">&nbsp;</div>

        <div class="fl">
            <label>published or not : </label>
            <?php echo $this->formSelect('postPublished', $this->postPublished, null, array(0 => 'false', 1 => 'true')); ?>
        </div>

        <div class="cl" style="height:15px;">&nbsp;</div>

        <div>
            <?php echo $this->formSelect('postCategoryId', $this->postCategoryId, null, $this->categoryOptions); ?>
        </div>

        <div class="cl" style="height:20px;">&nbsp;</div>

        <?php
        if (!empty($this->locales)) {
            foreach ($this->locales as $locale) {
        ?>
                <?php
                echo $this->formHidden('detailId[' . $locale->localeId . ']',
                                       $this->{'detailId_' . $locale->localeId});
                ?>

                <div class="fl">
                    <div>
                        <label>Title (<?php echo $locale->localeTitle; ?>) : </label><br />
                        <?php
                        echo $this->formText('detailTitle['.$locale->localeId.']',
                                             $this->{'detailTitle_' . $locale->localeId},
                                             array('maxlength' => 255, 'size' => '70'));
                        ?>
                    </div>

                    <br />

                    <div>
                        <label>Content (<?php echo $locale->localeTitle; ?>) : </label><br />
                        <?php
                        echo $this->fckeditor('detailContent[' . $locale->localeId . ']',
                                              $this->{'detailContent_' . $locale->localeId}, '550', '800');
                        ?>
                    </div>
                </div>
        <?php
            }
        }
        ?>

        <div class="cl" style="height:20px;">&nbsp;</div>

        <div>
            <?php echo $this->formSubmit('Save', 'Save'); ?>
        </div>

    </form>
</div>